﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="frmProductoStock.aspx.cs" Inherits="Farmacia.net.Almacen.frmProductoStock" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 96%;
        }
        .style5
        {
            text-align: right;
            width: 172px;
        }
        .style6
        {
            text-align: right;
            width: 251px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
 <fieldset>
<legend>Datos de Producto</legend>
                <asp:FormView ID="FormView1" runat="server" DataKeyNames="IdProducto" 
                    DataSourceID="ODSProd" Width="878px">
                    <EditItemTemplate>
                        <table class="style1">
                            <tr>
                                <td>
                                    IdProducto:</td>
                                <td>
                                    <asp:TextBox ID="IdProductoTextBox" runat="server" 
                                        Text='<%# Bind("IdProducto") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Proveedor:
                                </td>
                                <td>
                                    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="odsprove" 
                                        DataTextField="RazonSocial" DataValueField="IdProveedor">
                                    </asp:DropDownList>
                                    <asp:ObjectDataSource ID="odsprove" runat="server" 
                                        SelectMethod="GetAllFromProveedor" 
                                        TypeName="Farmacia.BussinessLogic.ProveedorBL"></asp:ObjectDataSource>
                                    <asp:TextBox ID="ProveedorTextBox" runat="server" 
                                        Text='<%# Bind("Proveedor") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Descripcion:
                                </td>
                                <td>
                                    <asp:TextBox ID="DescripcionTextBox" runat="server" 
                                        Text='<%# Bind("Descripcion") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    PrecioVentaUnidad:
                                </td>
                                <td>
                                    <asp:TextBox ID="PrecioVentaUnidadTextBox" runat="server" 
                                        Text='<%# Bind("PrecioVentaUnidad") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    PrecioVentaSubUnidad:
                                </td>
                                <td>
                                    <asp:TextBox ID="PrecioVentaSubUnidadTextBox" runat="server" 
                                        Text='<%# Bind("PrecioVentaSubUnidad") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Laboratorio:
                                </td>
                                <td>
                                    <asp:TextBox ID="LaboratorioTextBox" runat="server" 
                                        Text='<%# Bind("Laboratorio") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    GrupoFarmacologico:
                                </td>
                                <td>
                                    <asp:TextBox ID="GrupoFarmacologicoTextBox" runat="server" 
                                        Text='<%# Bind("GrupoFarmacologico") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    PrincActivo:
                                </td>
                                <td>
                                    <asp:TextBox ID="PrincActivoTextBox" runat="server" 
                                        Text='<%# Bind("PrincActivo") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                                        CommandName="Update" Text="Actualizar" />
                                </td>
                                <td>
                                    <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" 
                                        CommandName="Cancel" Text="Cancelar" />
                                </td>
                            </tr>
                        </table>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        IdProducto:
                        <asp:TextBox ID="IdProductoTextBox" runat="server" 
                            Text='<%# Bind("IdProducto") %>' />
                        <br />
                        Proveedor:
                        <asp:TextBox ID="ProveedorTextBox" runat="server" 
                            Text='<%# Bind("Proveedor") %>' />
                        <br />
                        Descripcion:
                        <asp:TextBox ID="DescripcionTextBox" runat="server" 
                            Text='<%# Bind("Descripcion") %>' />
                        <br />
                        PrecioVentaUnidad:
                        <asp:TextBox ID="PrecioVentaUnidadTextBox" runat="server" 
                            Text='<%# Bind("PrecioVentaUnidad") %>' />
                        <br />
                        PrecioVentaSubUnidad:
                        <asp:TextBox ID="PrecioVentaSubUnidadTextBox" runat="server" 
                            Text='<%# Bind("PrecioVentaSubUnidad") %>' />
                        <br />
                        Laboratorio:
                        <asp:TextBox ID="LaboratorioTextBox" runat="server" 
                            Text='<%# Bind("Laboratorio") %>' />
                        <br />
                        GrupoFarmacologico:
                        <asp:TextBox ID="GrupoFarmacologicoTextBox" runat="server" 
                            Text='<%# Bind("GrupoFarmacologico") %>' />
                        <br />
                        PrincActivo:
                        <asp:TextBox ID="PrincActivoTextBox" runat="server" 
                            Text='<%# Bind("PrincActivo") %>' />
                        <br />
                        <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                            CommandName="Insert" Text="Insertar" />
                        &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                            CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <table class="style1">
                            <tr>
                                <td class="style6">
                                    IdProducto:</td>
                                <td>
                                    <asp:Label ID="IdProductoLabel" runat="server" 
                                        Text='<%# Bind("IdProducto") %>' />
                                </td>
                                <td>
                                    Proveedor:
                                </td>
                                <td>
                                    <asp:Label ID="ProveedorLabel" runat="server" Text='<%# Bind("Proveedor") %>' />
                                </td>
                                <td>
                                    Laboratorio:</td>
                                <td>
                                    <asp:Label ID="LaboratorioLabel" runat="server" 
                                        Text='<%# Bind("Laboratorio") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td class="style6">
                                    Descripcion:
                                </td>
                                <td>
                                    <asp:Label ID="DescripcionLabel" runat="server" 
                                        Text='<%# Bind("Descripcion") %>' />
                                </td>
                                <td>
                                    PrincActivo:</td>
                                <td>
                                    <asp:Label ID="PrincActivoLabel" runat="server" 
                                        Text='<%# Bind("PrincActivo") %>' />
                                </td>
                                <td>
                                    G.Farma.:
                                </td>
                                <td>
                                    <asp:Label ID="GrupoFarmacologicoLabel" runat="server" 
                                        Text='<%# Bind("GrupoFarmacologico") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td class="style6" >
                                    Precio Unidad:</td>
                                <td>
                                    <asp:Label ID="PrecioVentaUnidadLabel" runat="server" 
                                        Text='<%# Bind("PrecioVentaUnidad") %>' />
                                </td>
                                <td>
                                    Precio SubUnidad</td>
                                <td>
                                    <asp:Label ID="PrecioVentaSubUnidadLabel" runat="server" 
                                        Text='<%# Bind("PrecioVentaSubUnidad") %>' />
                                </td>
                                <td>
                                    &nbsp;</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:FormView>
                <asp:ObjectDataSource ID="ODSProd" runat="server" 
                    onobjectcreating="ODSProd_ObjectCreating" SelectMethod="GetAllFromProductobyId" 
                    TypeName="Farmacia.BussinessLogic.ProductoBL" 
         DataObjectTypeName="Farmacia.Entities.Producto" DeleteMethod="DeleteProducto" 
         InsertMethod="RegistrarProducto" UpdateMethod="RegistrarProducto">
                    <DeleteParameters>
                        <asp:Parameter Name="id" Type="Int32" />
                    </DeleteParameters>
                    <SelectParameters>
                        <asp:QueryStringParameter DefaultValue="1007" Name="IdProducto" 
                            QueryStringField="IdProducto" Type="Int32" />
                    </SelectParameters>
                </asp:ObjectDataSource>
</fieldset>  

 <fieldset>
<legend>Stock Actual</legend>
                         <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                             AutoGenerateColumns="False" DataKeyNames="Id" 
         DataSourceID="ODSPRODSTOCK" Width="633px" CellPadding="4" 
         ForeColor="#333333" GridLines="None">
                             <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                             <Columns>
                                 <asp:CommandField HeaderText="Ver Detalle" SelectText="Ver Detalle" 
                                     ShowSelectButton="True">
                                 <HeaderStyle BackColor="#0066FF" Font-Bold="True" ForeColor="Black" />
                                 <ItemStyle Width="100px" />
                                 </asp:CommandField>
                                 <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id">
                                 <ItemStyle Width="30px" />
                                 </asp:BoundField>
                                 <asp:BoundField DataField="Ubicacion" HeaderText="Ubicacion" 
                                     SortExpression="Ubicacion">
                                 <ItemStyle Width="80px" />
                                 </asp:BoundField>
                                 <asp:BoundField DataField="Und" HeaderText="Und" SortExpression="Und">
                                 <ItemStyle Width="50px" />
                                 </asp:BoundField>
                                 <asp:BoundField DataField="StockU" HeaderText="StockU" SortExpression="StockU">
                                 <ItemStyle Width="50px" />
                                 </asp:BoundField>
                                 <asp:BoundField DataField="SubUnd" HeaderText="SubUnd" SortExpression="SubUnd">
                                 <ItemStyle Width="50px" />
                                 </asp:BoundField>
                                 <asp:BoundField DataField="StockSubU" HeaderText="StockSubU" 
                                     SortExpression="StockSubU">
                                 <ItemStyle Width="50px" />
                                 </asp:BoundField>
                                 <asp:BoundField DataField="Precio" DataFormatString="{0:c}" HeaderText="Precio" 
                                     SortExpression="Precio" />
                                 <asp:CheckBoxField DataField="Act" HeaderText="Act" SortExpression="Act" />
                             </Columns>
                             <EditRowStyle BackColor="#999999" />
                             <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                             <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                             <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                             <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                             <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                             <SortedAscendingCellStyle BackColor="#E9E7E2" />
                             <SortedAscendingHeaderStyle BackColor="#506C8C" />
                             <SortedDescendingCellStyle BackColor="#FFFDF8" />
                             <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                         </asp:GridView>
                         <asp:ObjectDataSource ID="ODSPRODSTOCK" runat="server" 
                             onobjectcreating="ODSPRODSTOCK_ObjectCreating" 
                             SelectMethod="GetFromProdAlmacenadoStockTotalbyIdProducto" 
                             TypeName="Farmacia.BussinessLogic.ProductoBL">
                             <SelectParameters>
                                 <asp:ControlParameter ControlID="FormView1" Name="IdProducto" 
                                     PropertyName="SelectedValue" Type="Int32" />
                             </SelectParameters>
                         </asp:ObjectDataSource>
</fieldset> 
<fieldset>
<legend>Detalle Producto por Ubicación </legend>

<asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
                    AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" 
                    BorderStyle="None" BorderWidth="1px" CellPadding="3" 
                    DataSourceID="ODSStockporAlmacen" GridLines="Vertical" 
        Width="889px">
                    <AlternatingRowStyle BackColor="#DCDCDC" />
                    <Columns>
                        <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id">
                        <HeaderStyle ForeColor="White" />
                        <ItemStyle Width="30px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Codigo" HeaderText="Codigo" SortExpression="Codigo">
                        <HeaderStyle ForeColor="White" />
                        <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Nombre" HeaderText="Nombre" SortExpression="Nombre">
                        <HeaderStyle ForeColor="White" />
                        <ItemStyle Width="300px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="NroLote" HeaderText="NroLote" 
                            SortExpression="NroLote">
                        <HeaderStyle ForeColor="White" />
                        <ItemStyle Width="50px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Vence" DataFormatString="{0:M-dd-yyyy}" 
                            HeaderText="Vence" SortExpression="Vence">
                        <HeaderStyle ForeColor="White" />
                        <ItemStyle HorizontalAlign="Left" Width="100px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Und" HeaderText="Und" SortExpression="Und">
                        <HeaderStyle ForeColor="White" />
                        <ItemStyle Width="40px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="StockU" HeaderText="StockU" SortExpression="StockU">
                        <HeaderStyle ForeColor="White" />
                        <ItemStyle Width="40px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="SubUnd" HeaderText="SubUnd" SortExpression="SubUnd">
                        <HeaderStyle ForeColor="White" />
                        <ItemStyle Width="40px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="StockSub" HeaderText="StockSub" 
                            SortExpression="StockSub">
                        <HeaderStyle ForeColor="White" />
                        <ItemStyle Width="40px" />
                        </asp:BoundField>
                        <asp:CheckBoxField DataField="Activo" HeaderText="Activo" 
                            SortExpression="Activo">
                        <HeaderStyle ForeColor="White" />
                        </asp:CheckBoxField>
                    </Columns>
                    <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                    <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                    <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
                    <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
                    <SortedAscendingCellStyle BackColor="#F1F1F1" />
                    <SortedAscendingHeaderStyle BackColor="#0000A9" />
                    <SortedDescendingCellStyle BackColor="#CAC9C9" />
                    <SortedDescendingHeaderStyle BackColor="#000065" />
                </asp:GridView>
<asp:ObjectDataSource ID="ODSStockporAlmacen" runat="server" 
                    onobjectcreating="ODSStockporAlmacen_ObjectCreating" 
                    SelectMethod="GetProdStockbyAlmacen" 
                    TypeName="Farmacia.BussinessLogic.ProductoBL">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="GridView1" Name="IdAlmcen" 
                            PropertyName="SelectedValue" Type="Int32" />
                        <asp:ControlParameter ControlID="FormView1" Name="IdProducto" 
                            PropertyName="SelectedValue" Type="Int32" />
                    </SelectParameters>
                </asp:ObjectDataSource>
    <br />
    <asp:Button ID="Button1" runat="server" Text="Volver" />
</fieldset> 
    
    <br />
    
</asp:Content>
